<?php
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class MainController extends AdminbaseController {
	
    public function index(){
    	
    	$mysql= M()->query("select VERSION() as version");
    	$mysql=$mysql[0]['version'];
    	$mysql=empty($mysql)?L('UNKNOWN'):$mysql;
    	
    	//server infomaions
    	$info = array(
    			L('OPERATING_SYSTEM') => PHP_OS,
    			L('OPERATING_ENVIRONMENT') => $_SERVER["SERVER_SOFTWARE"],
    			L('PHP_RUN_MODE') => php_sapi_name(),
    			L('MYSQL_VERSION') =>$mysql,
    			L('PROGRAM_VERSION') => "灵宝联社信息科技部2016-05",
    			L('UPLOAD_MAX_FILESIZE') => ini_get('upload_max_filesize'),
    			L('MAX_EXECUTION_TIME') => ini_get('max_execution_time') . "s",
    			L('DISK_FREE_SPACE') => round((@disk_free_space(".") / (1024 * 1024)), 2) . 'M',
    	);		
    	$this->assign('server_info', $info);
		//报修设备		
		$smanage_model = D("Smanage"); //分页使用由此开始，必须先实例化model，可以不用实例Page类。
		$lists  = $smanage_model->order('id desc')->limit(10)->where(array("sbzt"=>"故障"))->select(); //当用户是超级管理员时，显示所有设备信息
		$lists_count= $smanage_model->order('id desc')->where(array("sbzt"=>"故障"))->count(); //总记录数		
		$this -> assign('lists_count',$lists_count); //输出总记录数			
		$this->assign('lists',$lists);  // 赋值数据集			
    	$this->display();
	}
}
